package test;

import com.hjl.mybatis.entity.Emp;
import com.hjl.mybatis.mapper.DeptMapper;
import com.hjl.mybatis.mapper.EmpMapper;
import com.hjl.mybatis.utils.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author ServivE
 * @version 0.1
 * @className MyTest1
 * @description
 * @date 2024/7/31 9:47
 * @since jdk11
 */
public class MyTest1 {
    SqlSession session = null;
    EmpMapper empMapper = null;
    DeptMapper deptMapper = null;

    @Before
    public void init() {
        session = SqlSessionFactoryUtil.getSqlSession();
        //获取mapper接口对象
        empMapper = session.getMapper(EmpMapper.class);
        deptMapper = session.getMapper(DeptMapper.class);
    }

    @Test
    public void delEmps() {
        int[] emps = {1015, 1016, 1017};
        int result = empMapper.delEmps(emps);
        System.out.println("result===" + result);
    }
    @Test
    public void testGetEmpByStep() {
        Emp emp = empMapper.getEmpByStep(4);
        System.out.println(emp);
    }

    @After
    public void destory() {
//        session.commit();
        session.close();
    }
}
